package com.xbongbong.saas.enums;

import lombok.Getter;

import java.util.Objects;

/**
 * @author guohui.zhang
 * @Title: 页面页码枚举
 * @date 2020/4/2813:56
 */
@Getter
public enum PageSetEnum {

    Center(1,"居中","center"),
    RIGHT(2,"右对齐","right"),
    LEFT(3,"左对齐","left");
    /**
     * 枚举值
     */
    private Integer code;
    /**
     * 对齐方式
     */
    private String alignment;
    private String name;

    /**
     * 构造一个<code>PageSetEnum</code>枚举对象
     * @param code
     * @param alignment
     * @param name
     */
    PageSetEnum(Integer code,String alignment ,String name){
        this.code = code;
        this.alignment = alignment;
        this.name = name;
    }

    public static PageSetEnum getByCode(Integer code) {
        for (PageSetEnum cacheCode : values()) {
            if (Objects.equals(code, cacheCode.getCode())) {
                return cacheCode;
            }
        }
        return null;
    }
}
